using System.Collections;
using Cysharp.Threading.Tasks;
using QFramework;
using UnityEngine;
using UnityEngine.AddressableAssets;

public class CargoPool : BasePool<Transform>, IController
{
    protected override void Awake()
    {
        Initialize();
    }
    protected override Transform OnCreatePoolItem()
    {
        var cargo = CreatePoolItem();
        return cargo.transform;
    }

    private Transform CreatePoolItem()
    {
        var obj = GameObject.Instantiate(this.GetModel<IGameModel>().CargoPrefab);

        return obj.transform;
    }

    protected override void OnGetPoolItem(Transform obj)
    {
        obj.gameObject.SetActive(true);
    }

    protected override void OnReleasePoolItem(Transform obj)
    {
        obj.gameObject.SetActive(false);
    }

    protected override void OnDestroyPoolItem(Transform obj)
    {
        Destroy(obj);
    }

    public IArchitecture GetArchitecture()
    {
        return DigitalTwin_GeLinMei_2.Interface;
    }
}
